package com.yaorange.teaching.service.impl;

import java.util.Collections;
import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.sun.org.apache.bcel.internal.generic.NEW;
import com.yaorange.teaching.domain.YaTeacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yaorange.teaching.mapper.YaClassMapper;
import com.yaorange.teaching.domain.YaClass;
import com.yaorange.teaching.service.IYaClassService;

/**
 * 课程Service业务层处理
 *
 * @author ruoyi
 * @date 2024-11-08
 */
@Service
public class YaClassServiceImpl implements IYaClassService
{
    @Autowired
    private YaClassMapper yaClassMapper;

    /**
     * 查询课程
     *
     * @param id 课程主键
     * @return 课程
     */
    @Override
    public YaClass selectYaClassById(Long id)
    {
        return yaClassMapper.selectYaClassById(id);
    }

    /**
     * 查询课程列表
     *
     * @param yaClass 课程
     * @return 课程
     */
    @Override
    public List<YaClass> selectYaClassList(YaClass yaClass)
    {
        return yaClassMapper.selectYaClassList(yaClass);
    }

    /**
     * 新增课程
     *
     * @param yaClass 课程
     * @return 结果
     */
    @Override
    public int insertYaClass(YaClass yaClass)
    {
        return yaClassMapper.insertYaClass(yaClass);
    }

    /**
     * 修改课程
     *
     * @param yaClass 课程
     * @return 结果
     */
    @Override
    public int updateYaClass(YaClass yaClass)
    {
        return yaClassMapper.updateYaClass(yaClass);
    }

    /**
     * 批量删除课程
     *
     * @param ids 需要删除的课程主键
     * @return 结果
     */
    @Override
    public int deleteYaClassByIds(Long[] ids)
    {
        return yaClassMapper.deleteYaClassByIds(ids);
    }

    /**
     * 删除课程信息
     *
     * @param id 课程主键
     * @return 结果
     */
    @Override
    public int deleteYaClassById(Long id)
    {
        return yaClassMapper.deleteYaClassById(id);
    }

    @Override
    public List<YaClass> selectYaClassOptions() {
        LambdaQueryWrapper<YaClass> queryWrapper = new LambdaQueryWrapper<>();
        //1-未开班  2-已开班 3-已结班
        queryWrapper.notIn(YaClass::getStatus, 3);
        return yaClassMapper.selectList(queryWrapper);
    }
}
